# use third libs
set(imgui_SOURCE_DIR ${THIRD_LIB}/imgui)
set(imgui_FileDialog_SOURCE_DIR ${THIRD_LIB}/ImGuiFileDialog)

set(IMGUI_FILES
  ${imgui_SOURCE_DIR}/imgui.h
  ${imgui_SOURCE_DIR}/imgui.cpp
  ${imgui_SOURCE_DIR}/imconfig.h
  ${imgui_SOURCE_DIR}/imgui_internal.h
  ${imgui_SOURCE_DIR}/imgui_draw.cpp
  ${imgui_SOURCE_DIR}/imgui_widgets.cpp
  ${imgui_SOURCE_DIR}/imgui_tables.cpp
  ${imgui_SOURCE_DIR}/imstb_textedit.h    # multi-line text-editing widget;
  ${imgui_SOURCE_DIR}/imstb_rectpack.h 
  ${imgui_SOURCE_DIR}/imstb_truetype.h
  
  ${imgui_SOURCE_DIR}/misc/cpp/imgui_stdlib.h
  ${imgui_SOURCE_DIR}/misc/cpp/imgui_stdlib.cpp
  
  ${imgui_SOURCE_DIR}/imgui_demo.cpp

  #${imgui_SOURCE_DIR}/backends/imgui_impl_glfw.h
  #${imgui_SOURCE_DIR}/backends/imgui_impl_glfw.cpp
  #${imgui_SOURCE_DIR}/backends/imgui_impl_opengl2.h
  #${imgui_SOURCE_DIR}/backends/imgui_impl_opengl2.cpp
  #${imgui_SOURCE_DIR}/backends/imgui_impl_opengl3.h
  #${imgui_SOURCE_DIR}/backends/imgui_impl_opengl3.cpp
  #${imgui_SOURCE_DIR}/backends/imgui_impl_opengl3_loader.h

  ${imgui_SOURCE_DIR}/backends/imgui_impl_sdl2.h
  ${imgui_SOURCE_DIR}/backends/imgui_impl_sdl2.cpp
  ${imgui_SOURCE_DIR}/backends/imgui_impl_sdlrenderer2.h
  ${imgui_SOURCE_DIR}/backends/imgui_impl_sdlrenderer2.cpp
  
  ${imgui_FileDialog_SOURCE_DIR}/ImGuiFileDialog.h
  ${imgui_FileDialog_SOURCE_DIR}/ImGuiFileDialog.cpp
  )

macro(use_imgui ag_project_name)
  target_compile_definitions(${ag_project_name} PRIVATE USE_LIB_IMGUI)
  #target_compile_definitions(${ag_project_name} PRIVATE _CRT_SECURE_NO_WARNINGS)

  target_include_directories(${ag_project_name} PRIVATE ${imgui_SOURCE_DIR})
  target_include_directories(${ag_project_name} PRIVATE ${imgui_SOURCE_DIR}/backends)
  target_include_directories(${ag_project_name} PRIVATE ${imgui_FileDialog_SOURCE_DIR})
endmacro(use_imgui)